<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        const arr = [5,4,6,7,8]
        // arr.forEach(item => {
        //     console.log(item)
        // })

        Array.prototype.myForeach = function (fn) {
            for(let i=0;i<this.length;i++) {
                fn(this[i],i,this)
            }
        }
        arr.myForeach((a,b,c)=>{
            console.log(a)
            // console.log(b)
            // console.log(c)
        })
    </script>
</body>
</html>